﻿using System.Text.RegularExpressions;

namespace Com.Core.Helps
{
    public class ValidateHelper
    {
        /// <summary>
        /// 输入是否为数字
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool IsNumeric(string str)
        {
            try
            {
                var i = int.Parse(str);
                return true;
            }
            catch
            {
                return false;
            }
        }

        /// <summary>
        /// 验证手机号
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool IsMobile(string str)
        {
            if (string.IsNullOrEmpty(str)) return false;
            var reg = @"^[0-9]*$";
            return Regex.IsMatch(str, reg);
        }

        /// <summary>
        /// 验证EMAIL
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool IsEmail(string str)
        {
            return true;
        }
    }
}
